<template>
  <div>
    <van-nav-bar title="首页" fixed />
    <div style="height: 45px"></div>
    <van-search v-model="searchvalue" placeholder="请输入搜索关键词" @click="search" />
    <swiper></swiper>
    <van-grid :column-num="4">
      <van-grid-item
        v-for="item in navDate"
        :key="value"
        :icon="item.image_src"
        :text="item.name"
      />
    </van-grid>

    <div v-for="item in floorDate">
      <img style="width: 100%" :src="item.floor_title.image_src" alt="" />
      <div v-for="items in item.product_list" style="float: left; margin: 2px">
        <img style="width: 100%; height: 120px" :src="items.image_src" alt="" />
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from "vue";
import swiper from "@/components/swiper.vue";
let navDate = ref(0);
import { navApi } from "@/api/api";
navApi().then((res) => {
  console.log("宫格数据", res);
  navDate.value = res.data.message;
});

let floorDate = ref(0);
import { floorApi } from "@/api/api";
import { useRouter } from "vue-router";
floorApi().then((res) => {
  console.log("楼层", res);
  floorDate.value = res.data.message;
});

let router=new  useRouter()
let searchvalue =ref('')
const search=()=>
{
    router.push('/search')
}
</script>

<style lang="scss" scoped>
</style>